package leetcode.editor.offer;

// 10.2 矩形覆盖
// http://www.cyc2018.xyz/%E7%AE%97%E6%B3%95/%E5%89%91%E6%8C%87%20Offer%20%E9%A2%98%E8%A7%A3/10.2%20%E7%9F%A9%E5%BD%A2%E8%A6%86%E7%9B%96.html#%E9%A2%98%E7%9B%AE%E9%93%BE%E6%8E%A5
public class Solution10II {
    // 类似于斐波那契的变种
    public int rectCover(int n) {
        if (n <= 2) return n;
        int pre1 = 1, pre2 = 2;
        int ans = 0;
        for (int i = 0; i <= n; i++) {
            ans = pre2 + pre1;
            pre2 = ans;
            pre1 = pre2;
        }
        return ans;
    }
}
